<?php

RegisterPlugin('Long', 'ActivePlugin_Long');

function ActivePlugin_Long()
{
    global $zbp;
    $zbp->LoadLanguage('theme', 'Long');
    $zbp->lang['msg']['first_button'] = '&lt;&lt;';
    $zbp->lang['msg']['prev_button'] = '&lt;';
    $zbp->lang['msg']['next_button'] = '&gt;';
    $zbp->lang['msg']['last_button'] = '&gt;&gt;';
    Add_Filter_Plugin('Filter_Plugin_ViewSearch_Begin', 'Long_ViewSearch_Begin');
    Add_Filter_Plugin('Filter_Plugin_Admin_TopMenu', 'Long_AddMenu');
}

function Long_ViewSearch_Begin()
{
    global $zbp;
    $zbp->option['ZC_SEARCH_TYPE'] = 'list';
}

function Long_AddMenu(&$m)
{
    global $zbp;
    $m[] = MakeTopMenu('root', 'Long主题设置', $zbp->host.'zb_users/theme/Long/main.php?act=base', '', 'topmenu_tpure');
}

function InstallPlugin_Long()
{
    global $zbp;
}

function UninstallPlugin_Long()
{
    global $zbp;
}

// 文章列表缩略图
function Long_firstimg($article)
{
    global $zbp;
    $randnum = mt_rand(1, 5);
    $pattern = "/<img.*?src=[\'|\"](.*?)[\'|\"].*?[\/]?>/i";
    $content = $article->Content;
    preg_match_all($pattern, $content, $matchContent);
    if (isset($matchContent[1][0])) {
        $temp = $matchContent[1][0];
    } else {
        $temp = $zbp->host.'zb_users/theme/Long/style/noimg/'.$randnum.'.jpg';
    }

    return $temp;
}
